﻿namespace WMS6.Web.Billing
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class ContractQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlContractID;
        protected DropDownList ddlContractType;
        protected DropDownList ddlEndTime;
        protected DropDownList ddlIsActive;
        protected DropDownList ddlIsActiveOper;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlStarTime;
        protected HtmlForm F9010;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlHead Head1;
        protected Label lblContract;
        protected Label lblContractID;
        protected Label lblContractType;
        protected Label lblEndTime;
        protected Label lblIsActive;
        protected Label lblOwnerID;
        protected Label lblStarTime;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtContractID;
        protected TextBox txtContractType;
        protected TextBox txtEndTime;
        protected TextBox txtOwnerID;
        protected TextBox txtStarTime;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("ContractList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("ContractList.aspx?action=" + base.UrlEncode(this.hdnActionID.Value), false);
        }

        private void LoadDDl()
        {
            base.InitQueryDDL(this.ddlContractID, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlContractType, 0);
            base.InitQueryDDL(this.ddlIsActiveOper, 0);
            base.InitQueryDDL(this.ddlStarTime, 1);
            base.InitQueryDDL(this.ddlEndTime, 1);
            base.InitIsActiveDDL(this.ddlIsActive, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            base.InitPage(this.Page);
            this.LoadDDl();
        }

        public string ContractID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtContractID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtContractID.Text.Trim(), this.ddlContractID.SelectedValue);
                }
                return "";
            }
        }

        public string ContractType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtContractType.Text.Trim()))
                {
                    return base.GetParamsString(this.txtContractType.Text.Trim(), this.ddlContractType.SelectedValue);
                }
                return "";
            }
        }

        public string EndTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
                {
                    return base.GetParamsString(this.txtEndTime.Text.Trim(), this.ddlEndTime.SelectedValue);
                }
                return "";
            }
        }

        public string IsActive
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsActive.Text.Trim()))
                {
                    return base.GetParamsString(this.ddlIsActive.Text.Trim(), this.ddlIsActiveOper.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string StartTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtStarTime.Text.Trim()))
                {
                    return base.GetParamsString(this.txtStarTime.Text.Trim(), this.ddlStarTime.SelectedValue);
                }
                return "";
            }
        }
    }
}

